package com.lh.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.lh.pojo.User;

/**
 	对用户信息的增改查
 **/
public interface UserMapper {
	
	@Select("SELECT * FROM t_userInfo WHERE uname=#{uname} AND upass=#{upass}")
	public User selUser(User user); //用户登录
	
	@Insert("INSERT INTO t_userInfo(uname,upass,picture,myname,sex,ubirth,uaddr,uphone VALUES"
			+ "(#{uname},#{upass},#{picture},#{myname},#{sex},#{ubirth},#{uaddr},#{uphone})")
	public int addUser(User user); //新用户注册
	
	@Select("SELECT * FROM t_userInfo WHERE uname=#{uname}")
	public User selUserByName(String name); //根据session的用户名查信息
	
	@Update("UPDATE t_userinfo SET myname=#{myname},sex=#{sex},ubirth=#{ubirth},uaddr=#{uaddr},uphone=#{uphone} WHERE uname=#{uname}")
	public int updUserInfo(User user); //修改用户信息
	
	@Update("UPDATE t_userinfo SET upass=#{0} where uname=#{1}")
	public int updUpass(String upass,String uname); //修改密码
	
	
}
